/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rps.controller;

import bean.entity.Applicants;
import bean.entity.Interviews;
import bean.session.ApplicantSessionBean;
import bean.session.InterviewSessionBean;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.component.UIInput;
import javax.faces.event.ValueChangeEvent;
import javax.faces.bean.SessionScoped;
import javax.faces.event.ActionEvent;

/**
 *
 * @author server
 */
@ManagedBean
@SessionScoped
public class ApplicantManagedBean implements Serializable {

    @EJB
    private ApplicantSessionBean applicantSessionBean;
    private Applicants app;
    private String name;
    private int Hired;
    private int Banned;
    private List<Applicants> listApplicant;

    /** Creates a new instance of ApplicantManagedBean */
    public ApplicantManagedBean() {
        listApplicant = new ArrayList<Applicants>();
        app = new Applicants();

    }

    public void renderPopup(ActionEvent e) {
        String param = (String) e.getComponent().getAttributes().get("demo");
        app = applicantSessionBean.findApplicantByID(param);
    }

    public String applicantDetails(Applicants app) {
        this.app = app;
        return "pretty:applicantdetails";
    }

   

    public List<Applicants> getAllApplicantse() {
        return listApplicant;
    }

    public int getcount(int param) {
        int i = 0;
        i = applicantSessionBean.countStatusApplicants(param);
        return i;
    }

    public void updateApplicant() {
        applicantSessionBean.updateApplicant(listApplicant);
    }

    public Applicants getApplicant() {
        return app;
    }

    public void setApplicant(Applicants ap) {
        this.app = ap;
    }

    /**
     * @return the app
     */
    public Applicants getApp() {
        return app;
    }

    /**
     * @param app the app to set
     */
    public void setApp(Applicants app) {
        this.app = app;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the Hired
     */
    public int getHired() {
        Hired = applicantSessionBean.countStatusApplicants(3);
        return Hired;
    }

    /**
     * @param Hired the Hired to set
     */
    public void setHired(int Hired) {
        this.Hired = Hired;
    }

    /**
     * @return the Banned
     */
    public int getBanned() {
        Banned = applicantSessionBean.countStatusApplicants(4);
        return Banned;
    }

    /**
     * @param Banned the Banned to set
     */
    public void setBanned(int Banned) {
        this.Banned = Banned;
    }
}
